package com.youth.entity;

import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

import com.youth.controller.jsr303.Insert;
import com.youth.controller.jsr303.Update;

public class UserInfo {
	
	@NotEmpty(message="{id不能为空}", groups={Update.class})
	@Length(min=30, max=32, message="{id.length.is.error}", groups={Insert.class, Update.class})
	private String id;
	
	@NotEmpty(message="username不能为空", groups={Insert.class, Update.class})
	@Pattern(regexp="[a-zA-Z0-9]{1,50}", message="{username.length.is.1-50}", groups={Insert.class, Update.class})
	private String username;
	
	@NotEmpty(message="password不能为空", groups={Insert.class, Update.class})
	@Length(min=6, max=32, message="{password.length.is.6-32}", groups={Insert.class, Update.class})
	private String password;
	
	private int age;
	private int sex; // 0男，1女，只允许这两个数字
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public int getSex() {
		return sex;
	}
	public void setSex(int sex) {
		this.sex = sex;
	}
	
}
